package com.baizan.daka.ui.activity

import android.content.Context
import android.content.Intent
import com.baizan.daka.base.BasePageListActivity
import com.baizan.daka.mvp.model.bean.MyTeam
import com.baizan.daka.mvp.model.bean.UserCaplitalDes
import com.baizan.daka.mvp.model.bean.UserTeam
import com.baizan.daka.net.BasePageResponse
import com.baizan.daka.net.bean.UserTeamDesBean
import com.baizan.daka.ui.adapter.MyTeamAdapter
import com.baizan.daka.ui.adapter.MyTeamDesAdapter
import com.baizan.daka.ui.contract.MyTeamContract
import com.baizan.daka.ui.presenter.MyTeamPresenter
import com.dianzan.daka.R

class MyTeamDesActivity : BasePageListActivity<MyTeamPresenter, MyTeamDesAdapter>(), MyTeamContract.View {

    companion object {
        fun start(context: Context,id:Int) {
            val intent = Intent(context, MyTeamDesActivity::class.java)
            intent.putExtra("id",id)
            context.startActivity(intent)
        }
    }

    var  id :Int = 0

    override fun onRefresh() {
        presenter?.loadTeamDes(mCurrentPageNo,id)
    }

    override fun onLoadMore() {
        presenter?.loadTeamDes(mCurrentPageNo,id)
    }

    override fun initAdapter(): MyTeamDesAdapter = MyTeamDesAdapter()

    override fun initPresenter(): MyTeamPresenter = MyTeamPresenter(this)

    override fun initView() {
        id =intent.getIntExtra("id",0)
    }

    override fun start() {
        presenter?.loadTeamDes(mCurrentPageNo,id)
    }

    override fun layoutId(): Int = R.layout.act_my_teamdes
    override fun loadSuccess(date: List<MyTeam>) {

    }

    override fun loadTeamDes(data: BasePageResponse<UserTeamDesBean>) {
        getDatasSuccess(data)
    }

    override fun loadTeamDesFail() {
        getDatasFail()
    }

}